class PopUpManager
{
    static popUp = {};
    static createPopUp(b,a,p = false,l = 0,m = 300,h = true):egret.Tween
    {
        var g: any = egret.Tween.get(a);
        if(b.contains(a))
        {
            return g;
        }
        if(p)
        {
            var e = new egret.Sprite;
            e.width = WindSpirit.Util.stageW;
            e.height = WindSpirit.Util.stageH;
            e.graphics.beginFill(0,0.3);
            e.graphics.drawRect(0,0,WindSpirit.Util.stageW,WindSpirit.Util.stageH);
            e.graphics.endFill();
            e.touchEnabled = !0;
            b.addChild(e);
            this.popUp[a.hashCode] = e;
            EffectUtils.fadeIn(e);
        }
        b.addChild(a);
        if(h)
        {
            b = b.globalToLocal((WindSpirit.Util.stageW - a.width) >> 1,(WindSpirit.Util.stageH - a.height) >> 1);
            a.x = b.x;
            a.y = b.y;
        }
        switch(l)
        {
            case 1:
                g = EffectUtils.gentlyPop(a,m);
                break;
            case 2:
                g = EffectUtils.violentPop(a,m);
                break;
            case 3:
                g = EffectUtils.leftSlidingIn(a,m);
                break;
            case 4:
                g = EffectUtils.rightSlidingIn(a,m);
                break;
            case 5:
                g = EffectUtils.topSlidingIn(a,m);
                break;
            case 6:
                g = EffectUtils.bottomSlidingIn(a,m)
        }
        return g;
    }
    static removePopUp(b,a = 0,e = 300):egret.Tween
    {
        var l: any = null;
        var m = function()
        {
            b.parent && b.parent.removeChild(b);
        };
        this.popUp[b.hashCode] && EffectUtils.fadeOut(this.popUp[b.hashCode]).call(function()
        {
            if(this.popUp[b.hashCode])
            {
                this.popUp[b.hashCode].parent.removeChild(this.popUp[b.hashCode]);
                delete this.popUp[b.hashCode];
            }
        },this);
        switch(a)
        {
            case 0:
                m();
                break;
            case 11:
                l = EffectUtils.narrowDisappear(b,e).call(m,this);
                break;
            case 7:
                l = EffectUtils.leftSlidingOut(b,e).call(m,this);
                break;
            case 8:
                l = EffectUtils.rightSlidingOut(b,e).call(m,this);
                break;
            case 9:
                l = EffectUtils.topSlidingOut(b,e).call(m,this);
                break;
            case 10:
                l = EffectUtils.bottomSlidingOut(b,e).call(m,this);
                break;
            default:
                l = egret.Tween.get(b);
        }
        return l;
    }
}